<?php

declare (strict_types=1);


namespace app\admin\model\store;

use app\common\model\TimeModel;

/**
 * @mixin \think\Model
 */
class Goods extends TimeModel
{

    protected $name = "goods";

    protected $deleteTime = "delete_time";

    protected $defaultSoftDelete = 0;

    public function getIsPostageList()
    {
        return ['0' => '不包邮', '1' => '包邮',];
    }

    public function getIsRecommendList()
    {
        return ['0' => '不推荐', '1' => '推荐',];
    }

    public function getIsDelList()
    {
        return ['0' => '否', '1' => '是',];
    }

    public function getIsHotList()
    {
        return ['0' => '否', '1' => '是',];
    }

    public function getIsNewList()
    {
        return ['0' => '否', '1' => '是',];
    }

    public function getIsQualityList()
    {
        return ['0' => '否', '1' => '是',];
    }

    public function getIsStatusList()
    {
        return ['0' => '下架', '1' => '上架',];
    }

    public function getIsSpecificaList()
    {
        return ['0' => '单规格', '1' => '多规格',];
    }
    //商品关联sku
    public function sku()
    {
        return $this->hasMany(GoodsSku::class, 'goods_id', 'id');
    }

    public function comment()
    {
        return $this->hasMany(GoodsComment::class, 'goods_id', 'id');
    }

    //商品关联商品分类
    public function goodsCate()
    {
        return $this->belongsTo(GoodsCate::class, 'goods_type', 'id')->bind(['cate_name']);
    }


}

